<?php
header("Content-Type: application/xml; charset=utf-8"); 

$fp = fopen("../logs/informatique.xml", "r") or die(" Fichier introuvable. L'analyse a ete suspendue");


// Fixes the encoding to uf8 
function fixEncoding($in_str) 
{ 
  $cur_encoding = mb_detect_encoding($in_str) ; 
  if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) 
    return $in_str; 
  else 
    return utf8_encode($in_str); 
} 

// Entete XML Manquant ->
print '<?xml version="1.0" encoding="UTF-8"?>
'; // retour a la ligne..


while ($fdata = fread($fp, 2048)){
	 print fixEncoding($fdata);
}



?>
